<?xml version="1.0"?>
<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format" version="1.0">
 
	<xsl:template match="Personnes">
		<fo:root>
			<fo:layout-master-set>
				<fo:simple-page-master master-name="first" page-width="210mm" page-height="297mm" margin-top="0.5in" margin-bottom="0.5in" margin-left="0.5in" margin-right="0.5in">
					<fo:region-body   margin-bottom="2cm"/>

					<fo:region-before region-name="xsl-region-before" extent="3cm"/>
					<fo:region-after region-name="xsl-region-after" extent="6mm"/>
				</fo:simple-page-master>
			</fo:layout-master-set>

			<fo:page-sequence master-reference="first">
				<fo:static-content flow-name="xsl-region-after">
					<fo:block text-align="center" color="white" background-color="black"><fo:page-number/></fo:block>
				</fo:static-content>
          
				<fo:flow flow-name="xsl-region-body">
						<fo:block padding="10px" text-align="center" color="white" background-color="black" >
							Liste des Personnes
						</fo:block>
					<fo:block space-after="5mm"></fo:block>
						<xsl:apply-templates select="CV">
							<xsl:sort select="." order="ascending" data-type="text"/>
						</xsl:apply-templates>


					<fo:block break-after="page"></fo:block>
						<fo:block padding="10px" text-align="center" color="white" background-color="black" >
							Liste des Competences
						</fo:block>
					<fo:block space-after="5mm"></fo:block>
						<xsl:apply-templates select="document('Competences.xml')" />
				</fo:flow>
			</fo:page-sequence>
		</fo:root>
	</xsl:template>

   
	<xsl:template match="//CV">
	  <fo:block-container>
		  <fo:block>Nom : <xsl:value-of select="Nom"/></fo:block>
		  <fo:block space-after="3mm">Prenom : <xsl:value-of select="Prenom"/></fo:block>
	  </fo:block-container> 
	</xsl:template>

	<xsl:template match="Competences">
			<xsl:apply-templates select="Competence">
				<xsl:sort select="Type" order="ascending" data-type="text"/>
			</xsl:apply-templates>
	</xsl:template>

	<xsl:template match="//Competence">
		<fo:block>Nom : <xsl:value-of select="Nom"/></fo:block>
		<fo:block space-after="3mm">Type : <xsl:value-of select="Type"/></fo:block>
	</xsl:template>

 
</xsl:stylesheet>
